#include <iostream>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <stdio.h>
#include <time.h>
#include <string.h>
#include <unistd.h>

using namespace std;

int main(int argc, char *argv[])
{
    int sockfd;
    sockaddr_in serv_addr;
    hostent *server;

    sockfd = socket(AF_INET, SOCK_STREAM, 0);
    if(sockfd < 0)
    {
        cout << "Could not open socket.\n";
        exit(1);
    }

    server = gethostbyname("lethe.ugcs.caltech.edu");
    if(server == NULL)
    {
        cout << "Could not find host.\n";
        exit(1);
    }

    bzero((char *) &serv_addr, sizeof(serv_addr));
    serv_addr.sin_family = AF_INET;
    bcopy((char *)server->h_addr, (char*) &serv_addr.sin_addr.s_addr, server->h_length);
    serv_addr.sin_port = htons(5000);

    if(connect(sockfd, (sockaddr *) &serv_addr, sizeof(serv_addr)) < 0)
    {
        cout << "Could not connect.\n";
        exit(1);
    }

    int SIZE = 100000;
    char *buf = new char[SIZE];
    write(sockfd, buf, SIZE);


}
